"""
不允许有重复元素, 如果添加重复元素, 则会自动过滤, 可以进行交集, 并集的运算
是一种无序且无重复元素的数据结构
与 dict 类型, 是一组key的集合, 不能存储 value
"""
# 集合的创建
s = set()
print(s, type(s))
# list --> set
s = set([1, 2, 3, 4])
print(s)
# tuple --> set
s = set((1, 2, 3, 3))
print(s)
# str --> set
s = set('1233')
print(s)
# dict --> set 只能操作key
s = set({1:'1', 2:'2'})
print(s)
print(1 in s)
print(len(s))
print(max(s))

# 交集
s1 = {1, 2, 3, 4}
s2 = {1, 4, 5}
print(s1 & s2)  # & 取交集
print(s1 | s2)  # | 去并集
score = [90, 80, 70, 80]
different = set(score)
d = {}
for i in different:
    t = score.count(i)
    d[i] = t
for key, value in d.items():
    print("得分%d的有%d个人" % (key, value))




